package service

import (
	"yxs-mall/app/mall/elastic"
	"yxs-mall/app/mall/pojo/searchcond"
	logs "yxs-mall/common/log"
	"yxs-mall/common/service"
)

type Product struct {
	service.Service
}

func (e Product) GetProductList(cond *searchcond.ProductSearchCond) interface{} {
	//db := e.Orm
	//tx := db.Model(&models.MallProduct{}).Preload("Images").Preload("Files").Preload("Records")
	//pager := query.Pager[bo.ProductDocumentDetailBo]{DB: tx, PageNum: cond.PageNum, PageSize: cond.PageSize}
	//result := pager.Page()
	//targetR := make([]bo.ProductDocumentDetailBo, 1)
	//for _, v := range result.Hits {
	//	var tar bo.ProductDocumentDetailBo
	//	utils.SourceToTarget(&v, &tar)
	//	targetR = append(targetR, tar)
	//}
	search, err := elastic.ProductElastic.Search(cond)
	if err != nil {
		logs.Logger.Errorf(err.Error())
	}

	return search
}
